//
//  HSListModel.m
//  HolyShit
//
//  Created by Robin on 2017/3/24.
//  Copyright © 2017年 HolyShit. All rights reserved.
//

#import "HSListModel.h"
#import "NSString+Html.h"

@implementation HSListModel


- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        _imgsrc = [aDecoder decodeObjectForKey:@"imgsrc"];
        _title = [aDecoder decodeObjectForKey:@"title"];
        _ptime = [aDecoder decodeObjectForKey:@"ptime"];
        _postid = [aDecoder decodeObjectForKey:@"postid"];
        _replyCount = [[aDecoder decodeObjectForKey:@"replyCount"] integerValue];
        _articleType = [aDecoder decodeObjectForKey:@"articleType"];
        _skipType = [aDecoder decodeObjectForKey:@"skipType"];
        _digest = [aDecoder decodeObjectForKey:@"digest"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.imgsrc forKey:@"imgsrc"];
    [aCoder encodeObject:self.title forKey:@"title"];
    [aCoder encodeObject:self.ptime forKey:@"ptime"];
    [aCoder encodeObject:self.postid forKey:@"postid"];
    [aCoder encodeObject:@(self.replyCount) forKey:@"replyCount"];
    [aCoder encodeObject:self.articleType forKey:@"articleType"];
    [aCoder encodeObject:self.skipType forKey:@"skipType"];
    [aCoder encodeObject:self.digest forKey:@"digest"];
}

- (void)setDigest:(NSString *)digest
{
    NSString *result = [digest replaceRegStr:@"网易" WithStr:@""];
    _digest = result;
}

@end
